<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>我的订单 - 达内学子商城</title>
    <link href="../css/orders.css" rel="Stylesheet"/>
    <link href="../css/header.css" rel="Stylesheet"/>
    <link href="../css/footer.css" rel="Stylesheet"/>
    <link href="../css/personage.css" rel="stylesheet" />
</head>
<body>
<c:import url="header.jsp"></c:import>
<!-- nav主导航-->
<nav id="nav">
    <ul>
        <li><a href="index.jsp" class="acti">首页</a></li>
        <li><a href="index.jsp#computer" >电脑办公</a></li>
        <li><a href="index.jsp#stationery" >办公文具</a></li>
    </ul>
</nav>
<!-- 我的订单导航栏-->
<div id="nav_order">
    <ul>
        <li><a href="">首页<span>&gt;</span>个人中心</a></li>
    </ul>
</div>
<!--我的订单内容区域 #container-->
<div id="container" class="clearfix">
    <!-- 左边栏-->
    <c:import url="user_left_side_bar.jsp"/>
    <!-- 右边栏-->
    <!--个人信息头部-->
    <div class="rightsidebar_box rt">
        <div class="rs_header">
            <span ><a href="../user/profile.do">我的信息</a></span>
            <span class="rs_header_active"><a href="../user/password.do">安全管理</a></span>
        </div>

        <!--安全管理 -->
        <div class="rs_content">
            <p class="change_password_title">更改密码</p>
            <div class="new_password">
                <span class="word">输入旧密码：</span><input type="password" id="bt_oldpassword"/><span class="change_hint" id="oldpassword"></span>
            </div>
            <div class="new_password">
                <span class="word">输入新密码：</span><input type="password" id="bt_newpassword"/><span class="change_hint" id="newpassword"></span>
            </div>
            <div class="confirm_password">
                <span class="word">确认新密码：</span><input type="password" id="bt_upwdconfirm"/><span class="confirm_hint" id="upwdconfirm"></span>
            </div>
            <div class="save_password" onclick="changePassword()">
                保存更改
            </div>
        </div>


    </div>
</div>

<!-- 品质保障，私人定制等-->
<div id="foot_box">
    <div class="icon1 lf">
        <img src="../images/footer/icon1.png" alt=""/>

        <h3>品质保障</h3>
    </div>
    <div class="icon2 lf">
        <img src="../images/footer/icon2.png" alt=""/>

        <h3>私人定制</h3>
    </div>
    <div class="icon3 lf">
        <img src="../images/footer/icon3.png" alt=""/>

        <h3>学员特供</h3>
    </div>
    <div class="icon4 lf">
        <img src="../images/footer/icon4.png" alt=""/>

        <h3>专属特权</h3>
    </div>
</div>
<!-- 页面底部-->
<div class="foot_bj">
    <div id="foot">
        <div class="lf">
             <p class="footer1"><img src="../images/footer/logo.png" alt="" class=" footLogo"/></p>
             <p class="footer2"><img src="../images/footer/footerFont.png" alt=""/></p>
        </div>
        <div class="foot_left lf">
            <ul>
                <li><a href="#"><h3>买家帮助</h3></a></li>
                <li><a href="#">新手指南</a></li>
                <li><a href="#">服务保障</a></li>
                <li><a href="#">常见问题</a></li>
            </ul>
            <ul>
                <li><a href="#"><h3>商家帮助</h3></a></li>
                <li><a href="#">商家入驻</a></li>
                <li><a href="#">商家后台</a></li>
            </ul>
            <ul>
                <li><a href="#"><h3>关于我们</h3></a></li>
                <li><a href="#">关于达内</a></li>
                <li><a href="#">联系我们</a></li>
                <li>
                    <img src="../images/footer/wechat.png" alt=""/>
                    <img src="../images/footer/sinablog.png" alt=""/>
                </li>
            </ul>
        </div>
        <div class="service">
            <p>学子商城客户端</p>
            <img src="../images/footer/ios.png" class="lf">
            <img src="../images/footer/android.png" alt="" class="lf"/>
        </div>
        <div class="download">
            <img src="../images/footer/erweima.png">
        </div>
		<!-- 页面底部-备案号 #footer -->
        <div class="record">
            &copy;2017 达内集团有限公司 版权所有 京ICP证xxxxxxxxxxx
        </div>
    </div>

</div>
</body>
<script type="text/javascript" src="../js/jquery-3.1.1.min.js"></script>
<script src="../js/index.js"></script>
<script src="../js/jquery.page.js"></script>
<script type="text/javascript" src="../js/orders.js"></script>
<script type="text/javascript">

    //左边栏显示问题
    $(function () {
        $("#leftsidebar_box dd").hide();
        $("#leftsidebar_box .count_managment dd").show();
        $(".my_order td img").attr("src","../images/myOrder/myOrder2.png");
        $(".count_managment td img").attr("src","../images/myOrder/myOrder1.png");

    });

    //密码修改相关功能
    $('#bt_oldpassword').blur(f1);
    $('#bt_newpassword').blur(f2);
    $('#bt_upwdconfirm').blur(f3);

    function f1() {
        var bt1 = $('#bt_oldpassword').val();
        console.log(bt1.length);
        if (bt1.length < 6 || bt1.length > 12) {
            $('#oldpassword').html("密码长度6-12位");
            $('#oldpassword').css({"color":"red","font-size":"6px"});
        }else {
            $('#oldpassword').html("密码格式正确");
            $('#oldpassword').css({"color":"green","font-size":"6px"});
        }


    }

    function f2() {
        var bt2 = $('#bt_newpassword').val();
        if (bt2.length < 6 || bt2.length > 12) {
            $('#newpassword').html("密码长度6-12位");
            $('#newpassword').css({"color":"red","font-size":"6px"});
        }else {
            $('#newpassword').html("密码格式正确");
            $('#newpassword').css({"color":"green","font-size":"6px"});
        }

    }

    function f3() {
        var bt3 = $('#bt_upwdconfirm').val();
        if (bt3.length < 6 || bt3.length > 12) {
            $('#upwdconfirm').html("密码长度6-12位");
            $('#upwdconfirm').css({"color":"red","font-size":"6px"});
        }else {
            $('#upwdconfirm').html("密码格式正确");
            $('#upwdconfirm').css({"color":"green","font-size":"6px"});
        }

        var bt2 = $('#bt_newpassword').val();
        if (bt3.length != bt2.length) {
            $('#upwdconfirm').html("两次密码长度不一致");
            $('#upwdconfirm').css({"color":"red","font-size":"6px"});
        }
        if (bt3 != bt2) {
            $('#upwdconfirm').html("两次输入密码不一致");
            $('#upwdconfirm').css({"color":"red","font-size":"6px"});
        }
    }

    function changePassword() {
        var url = '/user/handle_change_password.do';
        var data = {oldpassword:$('#bt_oldpassword').val(),
                    newpassword:$('#bt_newpassword').val(),
                    upwdconfirm:$('#bt_upwdconfirm').val()};
        $.post(url, data, function (result) {
            if (result.state == 0){
                alert('修改成功');
                $('#bt_oldpassword').val('');
                $('#bt_newpassword').val('');
                $('#bt_upwdconfirm').val('');
            }else {
                var message = result.message;
                // alert(message);
                $('#bt_oldpassword').val('');
                $('#bt_newpassword').val('');
                $('#bt_upwdconfirm').val('');
                $('#oldpassword').html("");
                $('#newpassword').html("");
                $('#upwdconfirm').html("");
                $('#upwdconfirm').html(message);
            }
        });
    }

</script>

</html>